package net.haiyue.api.custom;

public class BaseException extends RuntimeException {

    public static final BaseException INTERNAL_SERVER_ERR = new BaseException(101, "服务器出错了");

    public static final BaseException RECORD_NOT_FOUND = new BaseException(102, "查找不到相应数据");

    public static final BaseException PARAM_ERROR = new BaseException(103, "参数错误");

    public static final BaseException RECORD_ACCESS_FORBIDDEN = new BaseException(104, "无权限访问此数据");

    public static final BaseException QUERY_PARAM_ERROR = new BaseException(105, "查询参数错误");

    public static final BaseException ACCESS_TOO_BUSY = new BaseException(106, "调用接口过于频繁");

    /**
     * 异常信息
     */
    protected String msg;

    /**
     * 具体异常码
     */
    protected int code;

    public BaseException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public BaseException() {
        super();
    }

    public String getMsg() {
        return msg;
    }

    public int getCode() {
        return code;
    }

}
